{include file="common/header"}
<div id="app" v-cloak>
    <div class="el-pane-warp">
        <el-form :model="config" label-width="150px">
            <el-form-item>
                排名效果好，持续优化不可少。定期更新网站内容
                <span class="tips">（坚持定期发布文章，让搜索引擎常来您的网站）。保持高质量反链（做好站外优化，提高网站排名）</span>
            </el-form-item>
            <el-form-item label="站点地图：">
                <el-button 
                    size="small"
                    :loading="sitemapLoading"
                    @click="sitemapChange" 
                    icon="el-icon-refresh-right">
                    点击生成
                </el-button>
                <el-link :href="domain + '/sitemap.xml'" target="_blank" style="margin-left: 16px">点击查看</el-link>
            </el-form-item>
            <el-form-item label="百度收录：">
                必备操作<span class="tips">（ 完成必备操作后，60天左右收录，百度收录较慢）</span>
            </el-form-item>
            <el-form-item label="收录查询：">
                <el-link :href="'https://www.baidu.com/baidu?wd=site:' + included" target="_blank" type="primary">点击查询>> </el-link>
            </el-form-item>
            <el-form-item label="提交网址：">
                <el-link href="https://ziyuan.baidu.com/linksubmit/url" target="_blank" type="primary">点击提交>> </el-link>
                <el-checkbox v-model="config.baidu_url_status" :false-label="0" :true-label="1">已提交</el-checkbox>
            </el-form-item>
            <el-form-item label="自动推送：">
                <el-link href="https://ziyuan.baidu.com/property/index#bindmainpart" target="_blank" type="primary">点击去关联>> </el-link>
                <span>自动推送仅对关联过主体的站点开放。</span>
            </el-form-item>
            <el-form-item label="HTML标签验证:">
                <el-input v-model="config.baidu_html_code" placeholder="<meta name='' content='code-TEB65XXXXX' />" ></el-input>
                <span>&nbsp;&nbsp;&nbsp;在百度搜索资源平台获取您的HTML标签验证。</span>
                <el-link href="https://ziyuan.baidu.com/site/siteadd" target="_blank" type="primary">点击去获取>> </el-link>
            </el-form-item>
            <el-form-item label="谷歌收录：">
                必备操作<span class="tips">（ 完成必备操作后，15天左右收录，谷歌收录较快）</span>
            </el-form-item>
            <el-form-item label="收录查询：">
                <el-link :href="'https://www.google.com.hk/search?q=site:' + included" target="_blank" type="primary">点击查询>> </el-link>
            </el-form-item>
            <el-form-item label="提交网址：">
                <el-link href="http://www.google.cn/intl/zh-CN/add_url.html" target="_blank" type="primary">点击提交>> </el-link>
                <el-checkbox v-model="config.google_url_status" :false-label="0" :true-label="1">已提交</el-checkbox>
            </el-form-item>
            <el-form-item label="HTML标签验证:">
                <el-input v-model="config.google_html_code" placeholder="<meta name='' content='code-TEB65XXXXX' />"></el-input>
                <span>&nbsp;&nbsp;&nbsp;在谷歌搜索控制台中获取您的HTML标签验证。</span>
                <el-link href="https://www.google.com/webmasters/verification/verification?hl=en&tid=alternate" target="_blank" type="primary">点击去获取>> </el-link>
            </el-form-item>
        </el-form>
        <div class="el-bottom" style="width: 100%">
            <el-button 
                :loading="loading"
                type="primary" 
                size="medium" 
                icon="el-icon-refresh-right"
                @click="save()">
                保 存
            </el-button>
        </div>
    </div>
</div>
<script>
new Vue({
    el: '#app',
    data() {
        return {
            config: {:json_encode($config)},
            loading: false,
            sitemapUrl: "seo/seo/sitemap",
            updateUrl: "seo/seo/index",
            domain: "{$domain}",
            sitemap: "{$sitemap}",
            included: "{$included}",
            sitemapLoading: false,
        }
    },
    methods: {
        /**
         * 保存数据
         */
        save() {
            let self  = this;
            self.loading = true;
            request.post(self.updateUrl, {value: self.config}, function(res){
                self.loading = false;
                self.$notify({showClose: true, message: res.message, type: res.status});
            });
        },
        /**
         * 生成sitemap
         */
        sitemapChange() {
            let self = this;
            self.sitemapLoading = true;
            request.post(self.sitemapUrl, {}, function(res){
                self.sitemapLoading = false;
                self.$notify({showClose: true, message: res.message, type: res.status});
                if (res.status === "success") {
                    self.sitemap = true;
                }
            });
        },
    },
})
</script>
{include file="common/footer"}